package stream;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

class Person{
	String name;
	boolean ismarried;

	public Person(String name, boolean ismarried) {
		this.name = name;
		this.ismarried = ismarried;
	}

	@Override
	public String toString() {
		return "Person [name=" + name + ", ismarried=" + ismarried + "]";
	}
	
}

public class Stream2 {
	public static void main(String[] args) {
		
		List<Person> list = Arrays.asList(new Person("zs",true),
				new Person("ls",false),new Person("ww",true),new Person("ml",false));
		List<Person> list2 = list.stream().map((person)-> {person.ismarried=!
		        person.ismarried;return person;}).collect(Collectors.toList());
		System.out.println(list2);    
		
//		list.stream().collect(Collectors.groupingBy())
	}

}
